#ifndef CARDUTIL_H
#define CARDUTIL_H

#include "RTC5/RTC5impl.hpp"
#include "markerjob.h"
#include <QQueue>
#include <QThread>

class CardUtil : public QThread
{
    Q_OBJECT
public:
    CardUtil(QObject* parent = nullptr);
signals:
    void sig_markStarted(int);
    void sig_markFinished(int, int, int);
public slots:
    bool loadList(uint num);

    int setMarkerParamsList();

    bool mark(QList<MarkerPath> pathList);

    void run() override;

    void addJob(MarkerJob job);

    void setKValue(uint k);

    void stopMark();

    int get_mark_time();

    void readEncoder(long& enc00, long& enc10, long& enc01, long& enc11);

    void getEncoder(long& enc1, long& enc2);

    void setControlMode(uint);


private:
    uint k_value;
    QQueue<MarkerJob> mQueue;
    bool mMarking = false;
    bool mRuning = false;
    MarkerParam mMarkerParam;
    double lastPath = 0;
    bool externalStart = false;
};

#endif // CARDUTIL_H
